(function(n) {
  n(CodeMirror);
})(function(n) {
  n.defineOption("placeholder", "", function(e, t, o) {
    var s = o && o != n.Init;
    if (t && !s)
      e.on("blur", a), e.on("change", l), e.on("swapDoc", l), n.on(e.getInputField(), "compositionupdate", e.state.placeholderCompose = function() {
        f(e);
      }), l(e);
    else if (!t && s) {
      e.off("blur", a), e.off("change", l), e.off("swapDoc", l), n.off(e.getInputField(), "compositionupdate", e.state.placeholderCompose), i(e);
      var d = e.getWrapperElement();
      d.className = d.className.replace(" CodeMirror-empty", "");
    }
    t && !e.hasFocus() && a(e);
  });
  function i(e) {
    e.state.placeholder && (e.state.placeholder.parentNode.removeChild(e.state.placeholder), e.state.placeholder = null);
  }
  function r(e) {
    i(e);
    var t = e.state.placeholder = document.createElement("pre");
    t.style.cssText = "height: 0; overflow: visible", t.style.direction = e.getOption("direction"), t.className = "CodeMirror-placeholder CodeMirror-line-like";
    var o = e.getOption("placeholder");
    typeof o == "string" && (o = document.createTextNode(o)), t.appendChild(o), e.display.lineSpace.insertBefore(t, e.display.lineSpace.firstChild);
  }
  function f(e) {
    setTimeout(function() {
      var t = !1;
      if (e.lineCount() == 1) {
        var o = e.getInputField();
        t = o.nodeName == "TEXTAREA" ? !e.getLine(0).length : !/[^\u200b]/.test(o.querySelector(".CodeMirror-line").textContent);
      }
      t ? r(e) : i(e);
    }, 20);
  }
  function a(e) {
    p(e) && r(e);
  }
  function l(e) {
    var t = e.getWrapperElement(), o = p(e);
    t.className = t.className.replace(" CodeMirror-empty", "") + (o ? " CodeMirror-empty" : ""), o ? r(e) : i(e);
  }
  function p(e) {
    return e.lineCount() === 1 && e.getLine(0) === "";
  }
});
